<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>配送关系管理</title>
 <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>
<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">
    <section class="content-header">
        <h1>设置日志</h1>
        <ol class="breadcrumb">
           <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i>首页</a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">配送关系</a></li>
            <li class="active"><a href="#">配送关系设置</a></li>
        </ol>
    </section>
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
               <div class="input" style="margin-top:-5px;">
              <div class="textalign1">所属地区：</div>
                    <div class="boxinput">
                    	<table style="width:100%;">
                          <tr>
                             <td style="width:33%">
                                 <select class="textinput"  id="area1" name="area1" disabled="disabled">
                                    <option value="${area.areaId }">${area.areaName }</option>
                                 </select>
                             </td>
                             <td style="width:33%">
                                 <select class="textinput"  id="area2" name="area2"> </select>
                             </td>
                             <td style="width:33%">
                                  <select class="textinput"  id="area3" name="area3"></select>
                             </td>
                           </tr>
                         </table>
                  </div>
                  <div class="textalign">操作日期：</div>
                    <div class="boxinput">
                        <table style="width:100%;">
                          <tr>
                           <td style="width:50%">
                              <input class="textinput" type="text" id="startDate" placeholder="yyyy-MM-dd" maxlength="10" data-provide="datepicker" data-date-fmt="yyyy-MM-dd"/>
                           </td>
                           <td>&nbsp;-&nbsp;</td>
                           <td style="width:50%">
                              <input class="textinput" type="text" id="endDate"  placeholder="yyyy-MM-dd" maxlength="10" data-provide="datepicker" data-date-fmt="yyyy-MM-dd" />
                           </td>
                          </tr>
                        </table>
                    </div>  
                  <div class="textalign1">
                    <button    id="selectSee" type="button" onclick="gridSerch();" class="btn btn-success btn-sm">查&nbsp;询</button>
                  </div>  
             </div>			      
			</div>
		</div>
<div style="margin-top: 5px;"></div>
	<table class="jqgrid" id="gridlist"></table>
<div style="margin-top: 10px;"></div>
<div id="gridpage"></div>
<div class=" box box-warning bottongroup" id="bottongroup">
			<label  onclick="window.location.href='${ctx}/baseGoods/toSetDelByComp.html?goodsCode=${param.goodsCode}&projID=${param.projID}&goodsArea=${param.goodsArea}'"   class="btn btn-danger btn-sm" >返 回</label>
		</div>
</section>
<%@ include file="/WEB-INF/component/commonJS.jsp"%>
<script type="text/javascript">

//绑定回车   id="selectSee"
$('#area1,#area2,#area3,#startDate,#endDate').bind('keydown', function(event) {
    if (event.keyCode == "13") {
        $('#selectSee').click();
    }
}); 


$(document).ready(function (){
			$("#area2").HNSelect({
            	parent_selector: "#area1",  url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID",defaultText: "<option value=''>请选择</option>",
                func: function () {
                    $("#area3").HNSelect({
                        parent_selector: "#area2", url: "${pageContext.request.contextPath}/selectController/getArea.html", dataid: "ID", defaultText: "<option value=''>请选择</option>",
                        		
                    });
                }
            });
	jQuery("#gridlist").jqGrid({
		url: "${ctx}/baseGoods/getSetDelAreaLog.html?goodsCode=${param.goodsCode}&compCode=${compCode}",
	    mtype: "POST",
		datatype: "json",
		autowidth: true,
		shrinkToFit: true,
	//	height: 285,
	   	colNames:['','市（州）编码','市（州）名称','县（区）编码','县（区）名称','状态','操作时间'],
	   	colModel:[
	   		{name:'delRelId',index:'goodsCode',key:true,hidden:true,width:100,align:"center", sortable:false},
	   		{name:'fatherAreaCode',index:'compName',width:100,align:"center", sortable:false},
	   		{name:'fatherAreaName',index:'areaId',width:100, align:"center", sortable:false},
			{name:'areaCode',index:'areaId',width:100,align:"center", sortable:false},
	   		{name:'areaName',index:'areaName',width:100,align:"center", sortable:false},
	   		{name:'status',index:'areaName',width:100,align:"center", sortable:false},
	   		{name:'updDatetime',index:'areaName',width:100,align:"center", sortable:false}
	   	],
		gridComplete: function(){
			
		},
		 rowNum: 20,
	     rowList: [10, 20,50,100],
	     rownumbers: true,
	     multiselect:false,
	     pager: "#gridpage",
	     viewrecords: true,
	     gridComplete: function(){
	          	//序号列宽度自适应（参数为jqgridID）
	             autoRNWidth("gridlist");
	          	//数据只有一条时默认选中（参数为jqgridID）
	              selectByOneData("gridlist");
			     },
	     caption: "${param.goodsCode}/${form.drugCode}/${form.qualityspecName}/${form.formName}/${form.specName}/${form.factor}${form.unit}/${form.materialName}—${compName}",
	     jsonReader: {
	         repeatitems: false,
	         id: "ids"
	     }
	   	
	});
	 
	jQuery("#gridlist").jqGrid('navGrid',"prowed2",{edit:false,add:false,del:false});
	$("#gridlist").jqGrid("setGridHeight",create());
	$(window).trigger("resize");	
	
	
})
function gridSerch(){
	var area = $.trim($("#area3").val());
	var	fatherarea = $.trim($("#area2").val());
	var startDate = $.trim($("#startDate").val());
	var endDate = $.trim($("#endDate").val());
	$("#gridlist").jqGrid('setGridParam',{  
        datatype:'json',
        postData:{
        "goodsCode":"${param.goodsCode}",
        "compId":"${param.compId}",
        "areaCode":area,
        "fatherCode":fatherarea,
        "startDate":startDate,
        "endDate":endDate
        },
        page:1
    }).trigger("reloadGrid"); //重新载入  
}










	    
</script>
</body>
</html>